package com.lovetransferjia.chatuidemo.jia.activity;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;

import com.lovetransferjia.chatuidemo.R;
import com.lovetransferjia.chatuidemo.MyApplication;



public class Update extends Activity {
	public ProgressDialog pBar;
	private Handler handler = new Handler();
	public String appname = MyApplication.appName;

	private boolean checkSDCard() {
		if (android.os.Environment.getExternalStorageState().equals(
				android.os.Environment.MEDIA_MOUNTED))
			return true;
		else
			return false;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.jia_update);
		Dialog dialog = new AlertDialog.Builder(Update.this)
				.setTitle("系统更新")
				.setMessage("发现新版本，请更新！")
				// 设置内容
				.setPositiveButton("确定",// 设置确定按钮
						new DialogInterface.OnClickListener() {
							@Override
							public void onClick(DialogInterface dialog,
									int which) {
								Intent viewIntent = new Intent(
										"android.intent.action.VIEW",
										Uri.parse(MyApplication.updateBaseUrlString
												+ MyApplication.app
												+ MyApplication.serverVersion
												+ MyApplication.apppostfix));
								startActivity(viewIntent);

							}
						})
				.setNegativeButton("取消", new DialogInterface.OnClickListener() {
					public void onClick(DialogInterface dialog, int whichButton) {
						// 点击"取消"按钮之后退出程序
						finish();

					}
				}).create();// 创建
		// 显示对话框
		dialog.show();
	}

}